package com.xxg.imagemanager.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 查询商品Dao
 *
 * @author xuxiaogang
 * @date 2021-11-17
 */
@Mapper
@Component
public interface RenrenShopGoodsDao {

    /**
     * 获取店铺ID最大值
     *
     * @return 结果
     */
    @Select("select max(id) from renren_shop_goods")
    int getMaxId();

    /**
     * 在指定范围内查询数据
     *
     * @param start 开始ID
     * @param end   结束ID
     * @return 结果
     */
    @Select("select id,shop_id as shopId,status,thumb," +
            "thumb_all as thumbAll," +
            "is_deleted as isDeleted " +
            "from renren_shop_goods where id between #{start} and #{end}")
    List<RenrenShopGoods> selectByIdRange(@Param("start") int start, @Param("end") int end);
}